package cn.gjculture.shopping.api.controller;

import cn.gjculture.shopping.api.entity.PromotionTree;
import cn.gjculture.shopping.api.entity.Return;
import cn.gjculture.shopping.api.service.PromotionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/promotion")
public class PromotionController {

    @Autowired
    PromotionService promotionService;


    @GetMapping(value = "/tree/{customerId}")
    public Return<List<PromotionTree>> queryForTree(@PathVariable(value = "customerId") String customerId){
        Return<List<PromotionTree>> ret=new Return<>();
        List<PromotionTree> list=promotionService.queryForTree(customerId);
        ret.setData(list);
        return ret;
    }

}
